<html>
	<head>
		<meta http-equiv="content-type" content="text/html" />
		<meta name="author" content="Tilen Majerle" />
		<!--<meta http-equiv="refresh" content="2" />-->
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" href="style.css" type="text/css" />
		<title>STM32F4xx SD card website</title>
	</head>
	<body>
		<div id="header">
			Web server on STM32F4xx and SD card
		</div>
		<div id="main">
			<p><a href="subpage.shtml">Sub page with image</a></p>
			<p><a href="post.shtml">Try POST request</a></p>
			<table>
				<tr><td colspan="3" class="td_header">Program</td></tr>
				<tr><td colspan="2" class="bold">Compiled datetime</td><td><!--#compiled--></t></tr>
				<tr><td colspan="2" class="bold">Hardware</td><td><!--#hardware--></t></tr>
				<tr><td colspan="2" class="bold">Current time</td><td><!--#rtc_time--></t></tr>
				<tr><td colspan="3" class="td_header">Network</td></tr>
				<tr><td colspan="2" class="bold">Local address</td><td><!--#srv_adr--></t></tr>
				<tr><td colspan="2" class="bold">MAC address</td><td><!--#mac_adr--></t></tr>
				<tr><td colspan="2" class="bold">Gateway</td><td><!--#gateway--></t></tr>
				<tr><td colspan="2" class="bold">Netmask</td><td><!--#netmask--></t></tr>
				<tr><td colspan="2" class="bold">Link</td><td><!--#link--></t></tr>
				<tr><td colspan="2" class="bold">Duplex</td><td><!--#duplex--></t></tr>
				<tr><td colspan="3" class="td_header">Leds</td></tr>
				<tr><th>LED</th><th>Status</th><th>Actions</th></tr>
				<tr><td class="bold green">GREEN</td><td><!--#led1_s--></td><td><a href='/ledaction.cgi?ledtoggle=1'>Toggle</a><a href='/ledaction.cgi?ledon=1'>On</a><a href='/ledaction.cgi?ledoff=1'>Off</a></td></tr>
				<tr><td class="bold red">RED</td><td><!--#led3_s--></td><td><a href='/ledaction.cgi?ledtoggle=3'>Toggle</a><a href='/ledaction.cgi?ledon=3'>On</a><a href='/ledaction.cgi?ledoff=3'>Off</a></td></tr>
				<tr><td class="bold orange">ORANGE</td><td><!--#led2_s--></td><td><a href='/ledaction.cgi?ledtoggle=2'>Toggle</a><a href='/ledaction.cgi?ledon=2'>On</a><a href='/ledaction.cgi?ledoff=2'>Off</a></td></tr>
				<tr><td class="bold blue">BLUE</td><td><!--#led4_s--></td><td><a href='/ledaction.cgi?ledtoggle=4'>Toggle</a><a href='/ledaction.cgi?ledon=4'>On</a><a href='/ledaction.cgi?ledoff=4'>Off</a></td></tr>
				<tr><td colspan="3" class="td_header">Client</td></tr>
				<tr><td colspan="2" class="bold">All connections</td><td><!--#clt_a_c--></td></tr>
				<tr><td colspan="2" class="bold">Successful connections</td><td><!--#clt_s_c--></td></tr>
				<tr><td colspan="2" class="bold">Percentage</td><td><!--#clt_per--></td></tr>
				<tr><td colspan="2" class="bold">TX Bytes</td><td><!--#clt_tx--></td></tr>
				<tr><td colspan="2" class="bold">RX Bytes</td><td><!--#clt_rx--></td></tr>
				<tr><td colspan="3" class="td_header">Server</td></tr>
				<tr><td colspan="2" class="bold">All connections</td><td><!--#srv_c--></td></tr>
				<tr><td colspan="2" class="bold">TX Bytes</td><td><!--#srv_tx--></td></tr>
				<tr><td colspan="2" class="bold">RX Bytes</td><td><!--#srv_rx--></td></tr>
				<tr><td colspan="3" class="td_header">About website</td></tr>
                <tr>
                    <td colspan="3">
                        <p>This website is hosted on my STM32F4-Discovery board and DP83848 ethernet PHY. Data, which are used for display to user are stored on SD card.</p>
                        <p>DP83848 works using LwIP ethernet stack. Communication between LwIP and DP83848 is done using Reduced MII (RMII) peripheral.</p>
                        <p>
                            This website is also able to serve user data (variables, SSI tags) and to handle GET requests (CGI handlers).
                            <dl>
                                <dt>SSI tags</dt>
                                <dd>SSI tags LwIP uses to serve formatted variable data to user. In code, one SSI handler is used which is used to all SSI tags. This web uses 21 SSI tags. They are used to show IP, RTC time, led status, and so on, practical everything on this site.</dd>
                                <dt>CGI handlers</dt>
                                <dd>CGI (Common gateway interface) can be used with LwIP to handle GET requests. In my case, I have one CGI handler, which is used to to drive leds (On, Off, Toggle functions). You can have more than just one handlers, so you can organize your requests. In my case, I have only one handler function, because I don't need any more in this case.</dd>
                            </dl>
                        </p>
                        <p>
                            When Discovery board is reset (when power is out, or when reprogramming) and program starts, first LwIP gets ip via DHCP protocol from my router.
                            Then first what I do is update my IP at home to my stm32f4-discovery.com server so you can access from there simple.
                        </p>
                        <p>
                            System also request unix time from server (TCP client) and stores is into RTC peripheral on STM32F4 device.
                            On board, I have DS18B20 temperature sensor, which measures temperatures and every measure when it does, data are uploaded to emoncms.org server.
                        </p>
                        <p>
                            So, this STM32F4 is fully network busy :D It must serve data from SD card to users who connect to, and simultaneously upload data (TCP client) to another server with about 1.5Hz connections.
                            My library allows up to 4 TCP client connections at a time.
                        </p>
                    </td>
                </tr>
			</table>
			<p class="float_right"><a href="http://stm32f4-discovery.com">Website by Tilen Majerle</a></p>
			<div class="clear"></div>
		</div>
	</body>
</html>